home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / BORLAND TURBO / RTLWIN32.PAK / INTSHCUT.H < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  14.8 KB  |  409 lines

  1. /*
  2.  * intshcut.h - Internet Shortcut interface definitions.
  3.  *
  4.  * Copyright (c) 1995-1996, Microsoft Corporation.  All rights reserved.
  5.  */
  6.  
  7. #ifndef __INTSHCUT_H__
  8. #define __INTSHCUT_H__
  9. #pragma option -b
  10.  
  11. /* Headers
  12.  **********/
  13.  
  14. #pragma option -b.
  15. #include <isguids.h>
  16. #pragma option -b
  17.  
  18. #ifdef __cplusplus
  19. extern "C" {                        /* Assume C declarations for C++. */
  20. #endif   /* __cplusplus */
  21.  
  22. /* Constants
  23.  ************/
  24.  
  25. /* Define API decoration for direct import of DLL functions. */
  26.  
  27. #ifdef _INTSHCUT_
  28. #define INTSHCUTAPI
  29. #else
  30. #define INTSHCUTAPI                 DECLSPEC_IMPORT
  31. #endif
  32.  
  33. /* HRESULTs */
  34.  
  35. //
  36. // MessageId: E_FLAGS
  37. //
  38. // MessageText:
  39. //
  40. //  The flag combination is invalid.
  41. //
  42. #define E_FLAGS                     MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x1000)
  43.  
  44. //
  45. // MessageId: IS_E_EXEC_FAILED
  46. //
  47. // MessageText:
  48. //
  49. //  The URL's protocol handler failed to run.
  50. //
  51. #define IS_E_EXEC_FAILED            MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x2002)
  52.  
  53. //
  54. // MessageId: URL_E_INVALID_SYNTAX
  55. //
  56. // MessageText:
  57. //
  58. //  The URL's syntax is invalid.
  59. //
  60. #define URL_E_INVALID_SYNTAX        MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x1001)
  61.  
  62. //
  63. // MessageId: URL_E_UNREGISTERED_PROTOCOL
  64. //
  65. // MessageText:
  66. //
  67. //  The URL's protocol does not have a registered protocol handler.
  68. //
  69. #define URL_E_UNREGISTERED_PROTOCOL MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, 0x1002)
  70.  
  71. /* Interfaces
  72.  *************/
  73.  
  74. //
  75. // Input flags for IUniformResourceLocator::SetURL().
  76. //
  77. typedef enum iurl_seturl_flags
  78. {
  79.    IURL_SETURL_FL_GUESS_PROTOCOL        = 0x0001,     // Guess protocol if missing
  80.    IURL_SETURL_FL_USE_DEFAULT_PROTOCOL  = 0x0002,     // Use default protocol if missing
  81. }
  82. IURL_SETURL_FLAGS;
  83.  
  84. //
  85. // Input flags for IUniformResourceLocator()::InvokeCommand().
  86. //
  87. typedef enum iurl_invokecommand_flags
  88. {
  89.    IURL_INVOKECOMMAND_FL_ALLOW_UI                  = 0x0001,
  90.    IURL_INVOKECOMMAND_FL_USE_DEFAULT_VERB          = 0x0002,    // Ignore pcszVerb
  91. }
  92. IURL_INVOKECOMMAND_FLAGS;
  93.  
  94. //
  95. // Command info for IUniformResourceLocator::InvokeCommand().
  96. //
  97.  
  98. typedef struct urlinvokecommandinfoA
  99. {
  100.    DWORD  dwcbSize;          // Size of structure
  101.    DWORD  dwFlags;           // Bit field of IURL_INVOKECOMMAND_FLAGS
  102.    HWND   hwndParent;        // Parent window.  Valid only if IURL_INVOKECOMMAND_FL_ALLOW_UI is set.
  103.    LPCSTR pcszVerb;          // Verb to invoke.  Ignored if IURL_INVOKECOMMAND_FL_USE_DEFAULT_VERB is set.
  104. }
  105. URLINVOKECOMMANDINFOA;
  106. typedef URLINVOKECOMMANDINFOA *PURLINVOKECOMMANDINFOA;
  107. typedef const URLINVOKECOMMANDINFOA CURLINVOKECOMMANDINFOA;
  108. typedef const URLINVOKECOMMANDINFOA *PCURLINVOKECOMMANDINFOA;
  109.  
  110. typedef struct urlinvokecommandinfoW
  111. {
  112.    DWORD   dwcbSize;          // Size of structure
  113.    DWORD   dwFlags;           // Bit field of IURL_INVOKECOMMAND_FLAGS
  114.    HWND    hwndParent;        // Parent window.  Valid only if IURL_INVOKECOMMAND_FL_ALLOW_UI is set.
  115.    LPCWSTR pcszVerb;          // Verb to invoke.  Ignored if IURL_INVOKECOMMAND_FL_USE_DEFAULT_VERB is set.
  116. }
  117. URLINVOKECOMMANDINFOW;
  118. typedef URLINVOKECOMMANDINFOW *PURLINVOKECOMMANDINFOW;
  119. typedef const URLINVOKECOMMANDINFOW CURLINVOKECOMMANDINFOW;
  120. typedef const URLINVOKECOMMANDINFOW *PCURLINVOKECOMMANDINFOW;
  121.  
  122. #ifdef UNICODE
  123. #define URLINVOKECOMMANDINFO            URLINVOKECOMMANDINFOW
  124. #define PURLINVOKECOMMANDINFO           PURLINVOKECOMMANDINFOW
  125. #define CURLINVOKECOMMANDINFO           CURLINVOKECOMMANDINFOW
  126. #define PCURLINVOKECOMMANDINFO          PCURLINVOKECOMMANDINFOW
  127. #else
  128. #define URLINVOKECOMMANDINFO            URLINVOKECOMMANDINFOA
  129. #define PURLINVOKECOMMANDINFO           PURLINVOKECOMMANDINFOA
  130. #define CURLINVOKECOMMANDINFO           CURLINVOKECOMMANDINFOA
  131. #define PCURLINVOKECOMMANDINFO          PCURLINVOKECOMMANDINFOA
  132. #endif
  133.  
  134.  
  135. #undef  INTERFACE
  136. #define INTERFACE IUniformResourceLocatorA
  137.  
  138. DECLARE_INTERFACE_(IUniformResourceLocatorA, IUnknown)
  139. {
  140.    /* IUnknown methods */
  141.  
  142.    STDMETHOD(QueryInterface)(THIS_
  143.                              REFIID riid,
  144.                              PVOID *ppvObject) PURE;
  145.    STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  146.    STDMETHOD_(ULONG, Release)(THIS) PURE;
  147.  
  148.    /* IUniformResourceLocator methods */
  149.  
  150.    STDMETHOD(SetURL)(THIS_
  151.                      LPCSTR pcszURL,
  152.                      DWORD dwInFlags) PURE;
  153.  
  154.    STDMETHOD(GetURL)(THIS_
  155.                      LPSTR *ppszURL) PURE;
  156.  
  157.    STDMETHOD(InvokeCommand)(THIS_
  158.                             PURLINVOKECOMMANDINFOA purlici) PURE;
  159. };
  160.  
  161. #undef  INTERFACE
  162. #define INTERFACE IUniformResourceLocatorW
  163.  
  164. DECLARE_INTERFACE_(IUniformResourceLocatorW, IUnknown)
  165. {
  166.    /* IUnknown methods */
  167.  
  168.    STDMETHOD(QueryInterface)(THIS_
  169.                              REFIID riid,
  170.                              PVOID *ppvObject) PURE;
  171.    STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  172.    STDMETHOD_(ULONG, Release)(THIS) PURE;
  173.  
  174.    /* IUniformResourceLocator methods */
  175.  
  176.    STDMETHOD(SetURL)(THIS_
  177.                      LPCWSTR pcszURL,
  178.                      DWORD dwInFlags) PURE;
  179.  
  180.    STDMETHOD(GetURL)(THIS_
  181.                      LPWSTR *ppszURL) PURE;
  182.  
  183.    STDMETHOD(InvokeCommand)(THIS_
  184.                             PURLINVOKECOMMANDINFOW purlici) PURE;
  185. };
  186.  
  187. #ifdef UNICODE
  188. #define IUniformResourceLocator         IUniformResourceLocatorW
  189. #define IUniformResourceLocatorVtbl     IUniformResourceLocatorWVtbl
  190. #else
  191. #define IUniformResourceLocator         IUniformResourceLocatorA
  192. #define IUniformResourceLocatorVtbl     IUniformResourceLocatorAVtbl
  193. #endif
  194.  
  195. typedef IUniformResourceLocator *PIUniformResourceLocator;
  196. typedef const IUniformResourceLocator CIUniformResourceLocator;
  197. typedef const IUniformResourceLocator *PCIUniformResourceLocator;
  198.  
  199. /* Prototypes
  200.  *************/
  201.  
  202. //
  203. // Input flags for TranslateURL().
  204. //
  205. typedef enum translateurl_in_flags
  206. {
  207.    TRANSLATEURL_FL_GUESS_PROTOCOL         = 0x0001,     // Guess protocol if missing
  208.    TRANSLATEURL_FL_USE_DEFAULT_PROTOCOL   = 0x0002,     // Use default protocol if missing
  209. }
  210. TRANSLATEURL_IN_FLAGS;
  211.  
  212. //
  213. //   TranslateURL().  This function applies common translations to a URL
  214. //  string, creating a new URL string.
  215. //
  216. //   This function does not perform any validation on the syntax of the input
  217. //  URL string.  A successful return value does not indicate that the input
  218. //  or output URL strings are valid URLS.
  219. //
  220. //   The function returns S_OK if the URL string is translated successfully
  221. //  and *ppszTranslatedURL points to the translated URL string.  S_FALSE
  222. //  is returned if the URL string did not require translation.  An error
  223. //  code is returned if an error occurs.
  224. //
  225. //  Parameters:
  226. //   pcszURL -- A pointer to the URL string to be translated.
  227. //   dwInFlags -- A bit field of TRANSLATEURL_IN_FLAGS.
  228. //   ppszTranslatedURL -- A pointer to the newly created, translated URL
  229. //     string, if any.  *ppszTranslatedURL is only valid if S_OK is returned.
  230. //     If valid, *ppszTranslatedURL should be freed by calling LocalFree().
  231. //     *ppszTranslatedURL is NULL on error.
  232. //
  233.  
  234. INTSHCUTAPI HRESULT WINAPI TranslateURLA(PCSTR pcszURL,
  235.                                          DWORD dwInFlags,
  236.                                          PSTR *ppszTranslatedURL);
  237. INTSHCUTAPI HRESULT WINAPI TranslateURLW(PCWSTR pcszURL,
  238.                                          DWORD dwInFlags,
  239.                                          PWSTR *ppszTranslatedURL);
  240. #ifdef UNICODE
  241. #define TranslateURL             TranslateURLW
  242. #else
  243. #define TranslateURL             TranslateURLA
  244. #endif   /* UNICODE */
  245.  
  246. //
  247. // Input flags for URLAssociationDialog().
  248. //
  249. typedef enum urlassociationdialog_in_flags
  250. {
  251.    URLASSOCDLG_FL_USE_DEFAULT_NAME        = 0x0001,
  252.    URLASSOCDLG_FL_REGISTER_ASSOC          = 0x0002,
  253. }
  254. URLASSOCIATIONDIALOG_IN_FLAGS;
  255.  
  256. //
  257. //   URLAssocationDialog().  This function invokes the unregistered URL
  258. //  protocol dialog box, providing a standard ui for choosing the handler for
  259. //  an unregistered URL protocol.
  260. //
  261. //  The functions returns S_OK if the application is registered with the
  262. //  URL protocol.  S_FALSE is returned if nothing is registered (a one-time
  263. //  execution via the selected application is requested).
  264. //
  265. //  Parameters:
  266. //   hwndParent -- A handle to the window to be used as the parent
  267. //   dwInFlags -- A bit field of URLASSOCIATIONDIALOG_IN_FLAGS.  The
  268. //                flags are:
  269. //
  270. //                  URLASSOCDLG_FL_USE_DEFAULT_NAME: Use the default Internet
  271. //                   Shortcut file name.  Ignore pcszFile.
  272. //
  273. //                  URLASSOCDLG_FL_REGISTER_ASSOC: The application
  274. //                   selected is to be registered as the handler for URLs
  275. //                   of pcszURL's protocol.  An application is only
  276. //                   registered if this flag is set, and the user indicates
  277. //                   that a persistent association is to be made.
  278. //
  279. //   pcszFile -- The name of the Internet Shortcut file whose URL's protocol
  280. //               requires a protocol handler.  Before a verb, like "open", can
  281. //               be invoked on an Internet Shortcut, a protocol handler must be
  282. //               registered for its URL protocol.  If
  283. //               URLASSOCDLG_FL_USE_DEFAULT_NAME is set in dwInFlags, pcszFile
  284. //               is ignored, and a default Internet Shortcut file name is used.
  285. //               pcszFile is only used for ui.
  286. //   pcszURL -- The URL whose unregistered protocol requires a handler.
  287. //   pszAppBuf -- A buffer to be filled in on success with the path
  288. //                of the application selected by the user.  pszAppBuf's
  289. //                buffer is filled in with the empty string on failure.
  290. //   ucAppBufLen -- The length of pszAppBuf's buffer in characters.
  291. //
  292.  
  293. INTSHCUTAPI HRESULT WINAPI URLAssociationDialogA(HWND hwndParent,
  294.                                                  DWORD dwInFlags,
  295.                                                  PCSTR pcszFile,
  296.                                                  PCSTR pcszURL,
  297.                                                  PSTR pszAppBuf,
  298.                                                  UINT ucAppBufLen);
  299. INTSHCUTAPI HRESULT WINAPI URLAssociationDialogW(HWND hwndParent,
  300.                                                  DWORD dwInFlags,
  301.                                                  PCWSTR pcszFile,
  302.                                                  PCWSTR pcszURL,
  303.                                                  PWSTR pszAppBuf,
  304.                                                  UINT ucAppBufLen);
  305. #ifdef UNICODE
  306. #define URLAssociationDialog     URLAssociationDialogW
  307. #else
  308. #define URLAssociationDialog     URLAssociationDialogA
  309. #endif  /* UNICODE */
  310.  
  311. //
  312. // Input flags for MIMEAssocationDialog().
  313. //
  314. typedef enum mimeassociationdialog_in_flags
  315. {
  316.    MIMEASSOCDLG_FL_REGISTER_ASSOC         = 0x0001,
  317. }
  318. MIMEASSOCIATIONDIALOG_IN_FLAGS;
  319.  
  320. //
  321. //   MIMEAssociationDialog().  Invokes the unregistered MIME content
  322. //  type dialog box.
  323. //
  324. //   This function does not perform any validation on the syntax of the
  325. //  input content type string.  A successful return value does not indicate
  326. //  that the input MIME content type string is a valid content type.
  327. //
  328. //   The function returns S_OK if the MIME content type is associated
  329. //  with the extension.  The extension is associated as the default
  330. //  extension for the content type.  S_FALSE is returned if nothing is
  331. //  registered.  Otherwise, the function returns one of the following
  332. //  errors:
  333. //
  334. //  E_ABORT -- The user cancelled the operation.
  335. //  E_FLAGS -- The flag combination passed in dwFlags is invalid.
  336. //  E_OUTOFMEMORY -- Not enough memory to complete the operation.
  337. //  E_POINTER -- One of the input pointers is invalid.
  338. //
  339. //  Parameters:
  340. //   hwndParent -- A handle to the window to be used as the parent
  341. //                 window of any posted child windows.
  342. //   dwInFlags -- A bit field of MIMEASSOCIATIONDIALOG_IN_FLAGS.  The
  343. //                flags are:
  344. //
  345. //              MIMEASSOCDLG_FL_REGISTER_ASSOC: If set, the application
  346. //               selected is to be registered as the handler for files of
  347. //               the given MIME type.  If clear, no association is to be
  348. //               registered.  An application is only registered if this
  349. //               flag is set, and the user indicates that a persistent
  350. //               association is to be made.  Registration is only possible
  351. //               if pcszFile contains an extension.
  352. //
  353. //   pcszFile -- A pointer to a string indicating the name of the file
  354. //               containing data of pcszMIMEContentType's content type.
  355. //   pcszMIMEContentType -- A pointer to a string indicating the content
  356. //                          type for which an application is sought.
  357. //   pszAppBuf -- A buffer to be filled in on success with the path of
  358. //                the application selected by the user.  pszAppBuf's buffer
  359. //                is filled in with the empty string on failure.
  360. //   ucAppBufLen -- The length of pszAppBuf's buffer in characters.
  361. //
  362.  
  363. INTSHCUTAPI HRESULT WINAPI MIMEAssociationDialogA(HWND hwndParent,
  364.                                                   DWORD dwInFlags,
  365.                                                   PCSTR pcszFile,
  366.                                                   PCSTR pcszMIMEContentType,
  367.                                                   PSTR pszAppBuf,
  368.                                                   UINT ucAppBufLen);
  369. INTSHCUTAPI HRESULT WINAPI MIMEAssociationDialogW(HWND hwndParent,
  370.                                                   DWORD dwInFlags,
  371.                                                   PCWSTR pcszFile,
  372.                                                   PCWSTR pcszMIMEContentType,
  373.                                                   PWSTR pszAppBuf,
  374.                                                   UINT ucAppBufLen);
  375. #ifdef UNICODE
  376. #define MIMEAssociationDialog    MIMEAssociationDialogW
  377. #else
  378. #define MIMEAssociationDialog    MIMEAssociationDialogA
  379. #endif  /* UNICODE */
  380.  
  381. //
  382. //   InetIsOffline().  This function determines if the user wants to be
  383. //  "offline" (get all information from the cache).  The dwFlags must be
  384. //  0.
  385. //
  386. //   The function returns TRUE to indicate that the local system is not
  387. //  currently connected to the Internet.  The function returns FALSE to
  388. //  indicate that either the local system is connected to the Internet,
  389. //  or no attempt has yet been made to connect the local system to the
  390. //  Internet.  Applications that wish to support an off-line mode should
  391. //  do so if InetIsOffline() returns TRUE.
  392. //
  393. //   Off-line mode begins when the user has been prompted to dial-in to
  394. //  an Internet providor, but canceled the attempt.
  395. //
  396. INTSHCUTAPI
  397. BOOL
  398. WINAPI
  399. InetIsOffline(
  400.     DWORD dwFlags);
  401.  
  402. #ifdef __cplusplus
  403. }                                   /* End of extern "C" {. */
  404. #endif   /* __cplusplus */
  405.  
  406. #pragma option -b.
  407. #endif   /* ! __INTSHCUT_H__ */
  408.  
  409.